{ pkgs, inputs, ... }:

{
  imports = [
    ./brew.nix
    ./dock.nix
  ];

  # List packages installed in system profile. To search by name, run:
  # $ nix-env -qaP | grep wget
  environment.systemPackages = with pkgs; [
  ];

  # Auto upgrade nix package and the daemon service.
  services.nix-daemon.enable = true;

  # Necessary for using flakes on this system.
  nix = {
    settings = {
      experimental-features = "nix-command flakes";
      substituters = [
        "https://mirrors.ustc.edu.cn/nix-channels/store"
      ];
    };
  };

  system = {
    # Set Git commit hash for darwin-version.
    configurationRevision = inputs.self.rev or inputs.self.dirtyRev or null;

    # Used for backwards compatibility, please read the changelog before changing.
    # darwin-rebuild changelog
    stateVersion = 5;

    startup.chime = false; # 启动铃声

    # 系统默认
    defaults = {
      SoftwareUpdate.AutomaticallyInstallMacOSUpdates = true; # 自动安装macOS软件更新
      alf.globalstate = 1; # 内部防火墙

      trackpad = {
        ActuationStrength = 0; # 静音点击
        Clicking = true; # 触控板点击
      };

      menuExtraClock = {
        ShowDate = 0; # 空间允许时显示完整日期
        ShowDayOfMonth = true;
        ShowDayOfWeek = true;
        ShowSeconds = true;
      };

      screencapture = {
        location = "/Users/daria/Pictures/Screenshots"; # 截屏保存路径
        type = "png";

      };


      loginwindow = {
        GuestEnabled = false; # 禁止访客登录
        autoLoginUser = "daria"; # 自动登录用户
      };

      NSGlobalDomain = {
        AppleFontSmoothing = 2; # 字体平滑度
        AppleICUForce24HourTime = true; # 24小时时间
        AppleInterfaceStyleSwitchesAutomatically = true; # 自动切换亮暗模式
        AppleShowAllExtensions = true; # 显示所有文件扩展名
        NSAutomaticCapitalizationEnabled = false; # 关闭自动大写
      };


      finder = {
        AppleShowAllExtensions = true; # 显示文件扩展名
        FXPreferredViewStyle = "Nlsv"; # 列表视图
        QuitMenuItem = true; # 允许完全退出Finder
        ShowStatusBar = true; # 显示状态栏
        ShowPathbar = true; # 显示路径栏
      };
    };
  };

  # The platform the configuration will be used on.
  nixpkgs.hostPlatform = "aarch64-darwin";

  # /etc/pam.d/sudo
  # `auth       sufficient     pam_tid.so`添加到`auth       required       pam_opendirectory.so`之前
  security.pam.enableSudoTouchIdAuth = true; # 指纹允许sudo
}
